﻿<!doctype html>
<html>
<head>
    <title>微街秀 >上传截图</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="plugins/bootstrap-fileinput-master/css/fileinput.min.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <style>
        #upimgs{width: 90%;height: 100%; max-height:400px;}
        .btn-file{text-align: center;margin-bottom: 10px;}
        .Centen{width: 60%;margin: 10px auto 25px auto;}
        .Uploadimg{width: 90%;margin: 20px auto 10px auto;text-align: center;height: 40px;line-height: 40px;border: #F37B0B 1px solid;border-radius: 5px;color: #F37B0B;font-size: 16px;}
        #ad_file{position: fixed;top: -100%;}
    </style>
</head>
<body>
    <form id="myform">
    <div class="wamtop">
        <div class="topleft" onclick="window.location.href='Makesh_4.html'">
            <img src="img/14.png"/>
        </div>
        <div class="topcententxt">
            上传截图</div>
    </div>
    <div class="Centen">
        <div>
            <div class="pt10">
                <input name="ad_file" id="ad_file" type="file" multiple="true">
            </div>
        </div>
        <input type="hidden" id="hftypeid" value="1" />
        <span style="color: #8F8F8F; font-size:12px;"> 此图为样本，参照此图进行截图。<br>
        请拉到通讯录底部，显示多少位联系人再截图。 </span>
    </div>
    <div class="Uploadimg">
        上传</div>
   
    <div style="width: 90%;margin: 20px auto 0 auto; color: #8F8F8F;line-height: 22px;">
        <div>说明：</div>
        <div>
            1、分享主须对在微街秀注册信息的真实性、合法性、有效性承担全部责任。
        </div> 
        <div>
            2、微街秀有权对分享主使用微街秀的情况进行审查和监督，分享主不得弄虚作假或不当使用账户，一经发现，微街秀有权暂停或终止分享主使用微街秀的权利，以及没收微街秀账户的费用，且不作任何补偿。
        </div>
        <br>
    </div>
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="js/jquery-form.js" type="text/javascript"></script>
    <script src="plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap-fileinput-master/js/fileinput.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap-fileinput-master/js/fileinput_locale_zh.js" type="text/javascript"></script>
    <script src="js/jquery-submit.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
    <script src="js/ajax-upload.js" type="text/javascript"></script>
    <script src="js/ajax-data.js" type="text/javascript"></script>
    <script src="js/base.js" type="text/javascript"></script>
    <script type="text/javascript">
        var logo = "";
        $(function () {           
            load();
            loadInput();
        });
        function load() {
            if (!islogin()) { window.location.href = 'login.html'; return; }
            AjaxStart("ajax/fc_setting.ashx?Get", "", function (data) {
                if (data.code == 0) {
                    if (data.item.wx_picurl == null || data.item.wx_picurl == "") return;
                    $("#upimgs").attr("src", data.item.wx_picurl);
                }
            });
        }
        function loadInput() {                   
            $("#ad_file").fileinput({
                showUpload: false,
                showCaption: false,
                showPreview: false,
                browseLabel: '',
                browseClass: "",
                browseIcon: '<img id="upimgs" src="img/Makeimg/21(1).png" />',
                removeClass: 'hide',
                fileType: "any",
                allowedFileExtensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg']
            });

     
            var userAgent = navigator.userAgent.toLocaleLowerCase();
            if (userAgent.indexOf("wjx") != -1 && userAgent.indexOf("android") != -1) {
                //客户端
                $("#ad_file").hide();
                $(".Uploadimg").on("click", function () {

                    var param = { type: 1, cutType: 2, width: 640, callback: "addContentImg", url: "http://" + window.location.host + "/Client/Ajax/Upload.ashx?Img" };
                    var p = JSON.stringify(param);

                    window.location.href = "callback://imageUpload?" + p;
                });
            }
            else {
                //网页 
                $(".Uploadimg").click(function () {
                    $("#ad_file").click();
                });

                //选择了图片提交图片
                $("#ad_file").change(function () {
                    if ($(this).val().length == 0) {
                        toast.show("文件格式错误");
                        return;
                    }
                    wait.show();
                    var urlimg = "";
                    if ($("#ad_file").val().toLocaleUpperCase().indexOf(".GIF") > -1) {
                        urlimg = "/Client/Ajax/Upload.ashx?Img";
                    }
                    else {
                        urlimg = "/Client/Ajax/Upload.ashx?Img&is_cut=1&width=640&height=1000";
                    }
                    //上传图片
                    $("#myform").ajaxSubmit({
                        type: 'post',
                        dataType: "json",
                        url: urlimg,
                        success: function (data) {
                            wait.dismiss();
                            $("#ad_file").val("");
                            addContentImg(data.item);
                            logo = data.item;
                        },
                        error: function (XmlHttpRequest, textStatus, errorThrown) {
                            wait.dismiss();
                            $("#ad_file").val("");
                        }
                    });
                });
            }
        }
        function addContentImg(src) {
            $("#upimgs").attr("src", src);
            var area1 = getStorage("area1");
            var area2 = getStorage("area2");
            var area3 = getStorage("area3");

            if (area1 == null) {
                area1 = "";
            }
            if (area2 == null) {
                area2 = "";
            }
            if (area3 == null) {
                area3 = "";
            }

            //更新微信好友列表截图
            AjaxStart("ajax/fc_setting.ashx?setting", "&wx_picurl=" + src + "&area1=" + area1 + "&area2=" + area2 + "&area3=" + area3, function (data) {
                if (data.code == "0")
                    window.location.href = "Makesh_4.html";
                else
                    Alert(data.msg);
            });
        }
    </script>
    </form>
</body>
</html>
